<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/style.css" />" />
<script type="text/javascript" src="<c:url value="/jquery.js" />"></script>
<script type="text/javascript" src="<c:url value="/scripts.js" />"></script>
<script type="text/javascript" src="<c:url value="/json2.js" />"></script>
<title><spring:message code="page.title" /></title>
</head>
<body>
<div id="addForm"><form:form commandName="user">
	<form:errors path="*" cssClass="errorBox" />
	<fieldset><legend>Dane osobowe</legend>
	<div><label>Pesel <form:input path="pesel" /></label></div>
	<div><label>Imie <form:input path="firstname" /></label></div>
	<div><label>Nazwisko <form:input path="lastname" /></label></div>
	<div><input type="submit" value="Zapisz" /></div>
	<div><input type="reset" value="Anuluj" /></div>
	</fieldset>
</form:form></div>
<div>
<c:if test="${previous>0}">
<a href="<c:url value="/app/customer/${previous}" />">previous</a> |
</c:if> 
${current}
<c:if test="${next<=sites}"> 
| <a href="<c:url value="/app/customer/${next}" />">next</a>
</c:if>
<table class="datatable">
	<thead>
		<tr>
			<th scope="colgroup" colspan="4" class="header">Baza osob</th>
		</tr>
		<tr>
			<th scope="col">Imie</th>
			<th scope="col">Nazwisko</th>
			<th scope="col">Pesel</th>
			<th scope="col"><a href="#" onclick="add()">add</a></th>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="customer" items="${customerList}">
			<tr>
				<td>
				<div class="editable">${customer.firstname}</div>
				</td>
				<td>
				<div class="editable">${customer.lastname}</div>
				</td>
				<td>
				<div>${customer.pesel}</div>
				</td>
				<td><a href="<c:url value="/app/customer/${current}" />"
					onclick="del(${customer.pesel})">delete</a></td>
			</tr>
		</c:forEach>
	</tbody>
</table>
</div>
</body>
</html>